package com.insa.flopenshop;

import java.io.FileNotFoundException;

public class Main {

	/**
	 * @param args
	 * @throws FileNotFoundException
	 */
	public static void main(String[] args) throws FileNotFoundException {
		Verificateur verif;
		Solution solution;

		/*
		for (Instance instance : Instance.getAllInstances()) {
			solution = (new HeuristiqueGloutonne()).solve(instance);
			verif = new Verificateur(instance, solution);
			if (verif.solutionValide()) {
				System.out.println("OK");
				System.out.println(solution.getTotalTime());
			} else {
				System.out.println("HE MERDE : " + instance.getFileName());
				System.out.println(solution.getTotalTime());
			}
		}*/
		
		for (Instance instance : Instance.getAllInstances()) {
			System.out.println(instance);
			System.out.println("\nDemarrage Algorithme Genetique");
			solution = (new AlgoGenetique(new Parametres(4, 0.1, 0.5, 0.25, 0.1, false))).solve(instance);
			verif = new Verificateur(solution);
			if (verif.solutionValide()) {
				System.out.println("Temps de la solution : " + solution.getTotalTime());
				System.out.println(solution);
			} else {
				System.out.println("Solution invalide : " + instance.getFileName());
			}
			System.out.println("\nDemarrage Algorithme Glouton");
			solution = (new HeuristiqueGloutonne(false)).solve(instance);
			verif = new Verificateur(solution);
			if (verif.solutionValide()) {
				System.out.println("Temps de la solution : " + solution.getTotalTime());
				System.out.println(solution);
			} else{
				System.out.println("Solution invalide : " + instance.getFileName());
			}
		}
	}
}
